This application is based on Japanese Patent Application No. H11-082529 filed on Mar. 25, 1999 and including specification, claims, drawings and summary. The disclosure of the above Japanese Patent Application is incorporated herein by reference in its entirety.
For data communications between computers such as PC (Personal Computers), the terminals send and receive start-and-stop synchronous AT commands for controlling communication devices such as a modem and terminal adapter (TA). The term xe2x80x9cAT commandxe2x80x9d generally refers to any instructions) sent to a communication device that begin with xe2x80x9cAT.xe2x80x9d The letters xe2x80x9cATxe2x80x9d generally refer to letters that get the communication device""s attention that you are about to send it a command. The communication device includes a circuit called UART (Universal Asynchronous Receiver-Transmitter) which receives the start-and-stop synchronous AT commands, and proceed communication in accordance with the received AT command.
1. Field of the Invention
The present invention relates to a device and a method for detecting data communication properties applied to received data based on received AT command.
2. Description of the Related Art
In a case where baud rate of the communication depends on the terminal""s ability for communication, suitable baud rate for the UART should be selected before proceeding communication. Various methods for selecting appropriate baud rate have been proposed.
For example, Unexamined Japanese Patent Application KOKAI Publication No. H10-294772 discloses a technique for detecting baud rate of received data based on length of a start bit of a first character. Based on the detected baud rate, a clock signal for reception is generated and supplied to the UART. Further, data bits following to the start bit which represent the first characterare stored in a shift register, and data bits representing a second character and following-characters are supplied to the UART. According to this structure, a term required for receiving the first character is fully used for setting baud rate to the UART. That is, a CPU can read the data for the first character from the shift register while the baud rate is being set to the UART. Thus, the baud rate setting and data reception can be done simultaneously, and it realizes successful detection of the start bit without delay in a case where intervals among commands are very short in high baud rate communication.
Unexamined Japanese Patent Application KOKAI Publication No. H09-153923 discloses a technique which realizes the baud rate detection, clock generation and.clock transfer to the UART without MPU processing. Further, bits having the same level as the start bit are always monitored, and baud rate detection starts unless successive at least 10 bits (1 bit for start bit, 7 bits for data bit, 1 bit for parity bit, and 1 bit for stop bit) whose level differs from start bit level appear. As a result, errors in baud rate detection are reduced.
In above described techniques, a CPU discriminates whether received data is AT command or not after reading data representing a first character in the shift register and receives following data via the UART. Once an AT command is received, that is, the received first and second characters are xe2x80x9cATxe2x80x9d (or xe2x80x9catxe2x80x9d), the CPU determines data format for the communication based on parity bits in data packets for the first and second characters.
Accordingly, the above conventional techniques requires CPU processing for controlling data communication. Since data packets representing commands successively arrive in high baud rate communication (for example, 1Mbps or faster), data reception is likely to fail if the CPU is occupied for other processing.
In a case where data communication is performed by a mobile terminal such as a mobile phone, a CPU should not work filly for the data communication in order to save batteries.
The present invention has been made in consideration of the above problems. It is an object of the present invention to provide a device and a method for detecting baud rate, parity, and data format to be set to a universal asynchronous receiver-transmitter without CPU processing.
According to a first aspect of the present invention, it is provided a method of detecting data communication property which is applicable to a device for receiving serial data and transferring the received serial data to a connected universal asynchronous receiver-transmitter, the method comprises:
receiving the serial data;
discriminating whether the serial data include an AT command;
detecting data communication property including baud rate of the received serial data, parity type, and data format, based on the received AT command;
generating a clock signal for receiving the serial data based on the detected baud rate and supplying the generated clock signal to the universal asynchronous receiver-transmitter; and
setting the detected data communication property to the universal asynchronous receiver-transmitter.
The above described method enables the device for receiving the serial data to detect the baud rate, the parity type, and the data format based on the AT command, and the detected information are set to the UART. Therefore, the UART can receive the serial data in accordance with the information without CPU processing.
In this case, the detecting may comprise detecting first and second characters represented by the serial data to discriminate whether the input characters represent the AT command; and
checking parity bits for the first and second characters of the AT command to detect the parity type and the data format based on level of the parity bits, and
the generating generates the clock signal when the discriminating discriminates that the input characters represent the AT command, and quits generating the clock signal when the discriminating discriminates a last character of the AT command.
The method may further comprise monitoring whether the serial data is supplied while measuring a time period during an interval of the data supply, and
quitting the baud rate detection when the measured time period exceeds a predetermined time period.
By thus structured method, the clock signal is not generated until the AT command is received. As a result, power consumption for the clock signal generation while standing by for the AT command arrival is reduced. Moreover, the baud rate detection rests when no serial data is supplied for the predetermined time period. As a result, more effective power saving is realized.
According to a second aspect of the present invention, it is provided a device for detecting data communication property which receives serial data and transfers the received serial data to a connected universal asynchronous receiver-transmitter, the device comprises;
at least one input terminal which receives externally supplied start-and-stop serial data;
a character discriminator which discriminates whether input characters in the received serial data represent the AT command;
a baud rate detector which detects, if the character discriminator discriminates that the input characters represent the AT command, a first data communication property including baud rate of the received serial data by measuring a start bit for a first character of the AT command in the received serial data;
a clock generator which generates a clock signal for data reception based on the detected baud rate, and supplies the generated clock signal to the universal asynchronous receiver-transmitter,
a property detector which detects, if the character discriminator discriminates that the input characters represent the AT command, a second data communication property including parity type and data format of the received serial data, based on the AT command;
an information relay which receives information representing the first and second communication properties from the baud rate detector and the property detector, and sets the received information to the universal asynchronous receiver-transmitter; and
a gate which stops flow of the serial data to the universal asynchronous receiver-transmitter while the first and second characters of the AT command are being input.
The above described device can detect the baud rate, the parity type, and the data format based on the received AT command, and set thus detected information to the UART. Moreover, the serial data representing the first and second characters of the AT command are not supplied to the UART. Thus, the UART can receive the serial data representing characters following to the second character of the AT command in accordance with the information without CPU processing.
In this case, the character discriminator may detect first and second characters represented by the serial data to discriminate whether the input characters represent the AT command, and
the property detector checks parity bits for the first and second characters of the AT command to detect the second data communication property based on level of the parity bits.
Moreover, the character discriminator may supply an instruction signal to the clock generator to generate a clock signal for data reception when the character discriminator discriminates that the received serial data represent the AT command, and the character discriminator quits supplying the instruction signal and discriminates whether a further AT command is received when the character discriminator detects a last character of the AT command; and
the clock generator generates the clock signal for the data reception in response to the instruction signal supplied by the character discriminator, and quits generating the clock signal when the supply of the instruction signal is stopped.
The device may further comprise a timeout detector which monitors whether the serial data is supplied while measuring a time period during an interval of the data supply, and controls the baud rate detector to quit the baud rate detection when the measured time period exceeds a predetermined time period.
In thus structured device, the clock generator does not generate the clock signal until the AT command is received. As a result, power consumption at the clock generator while standing by for the AT command arrival is reduced. Moreover, the baud rate detection by the baud rate detector rests when no serial data is supplied for the predetermined time period. As a result, more effective power saving is realized.
According to a third aspect of the present invention, it is provided a method of detecting data communication property which is applicable to a device for receiving an infrared signal representing serial data and transferring the received serial data to a connected universal asynchronous receiver-transmitter, the method comprises:
receiving an infrared signal representing the serial data;
modulating the infrared signal to output the serial data;
discriminating whether the serial data in the modulated infrared signal include an AT command;
detecting a data communication property including baud rate of the received serial data, parity type, and data format, based on the received AT command;
generating a clock signal for receiving the serial data and supplying the generated clock signal to the universal asynchronous receiver-transmitter when the discriminating discriminates that the received serial data include the AT command; and
setting the detected data communication property to the universal asynchronous receiver-transmitter.
The above described method enables the device for receiving the infrared signal representing the serial data. And the method enables modulation of the infrared signal to output the serial data. The baud rate, the parity type, and the data format are detected based on the received serial data, and the detected information are set to the UART. Therefore, the UART can receive the serial data in form of the infrared signal in accordance with the information without CPU processing.
In this case, the detecting may comprise detecting first and second characters represented by the serial data to discriminate whether the input characters represent the AT command; and
checking parity bits for the first and second characters of the AT command to detect the parity type and the data format based on level of the parity bits, and
the generating generates the clock signal when the discriminating discriminates that the input characters represent the AT command, and quit generating the clock signal when the discriminating discriminates a last character of the AT command.
The method may further comprise:
monitoring whether the serial data modulated by the modulating are output while measuring a time period during an interval of the data output, and
quitting the baud rate detection when the measured time period exceeds a predetermined time period.
By thus structured method, the clock signal is not generate until the AT command is received. As a result, power consumption for the clock signal generation while standing by for the AT command arrival is reduced. Moreover, the baud rate detection rests when no modulation is carried out for the predetermined time period. As a result, more effective power saving is realized.
According to a fourth aspect of the present invention, it is provided a device for detecting data communication property which receives serial data and transfers the received serial data to a connected universal asynchronous receiver-transmitter, the device comprises;
at least one input terminal which receives an externally supplied infrared signal representing start-and-stop serial data;
a demodulator which demodulates the infrared signal to output the serial data;
a character discriminator which discriminates whether input characters in the received serial data represent the AT command;
a baud rate detector which detects a first data communication property including baud rate of the serial data output by the demodulator;
a clock generator which generates a clock signal for data reception based on the detected baud rate, and supplies the generated clock signal to the universal asynchronous receiver-transmitter,
a property detector which detects, if the character discriminator discriminates that the input characters represent the AT command, a second data communication property including parity type and data format of the received serial data, based on the AT command;
an information relay which receives information representing the first and second data communication properties from the baud rate detector and the property detector, and sets the received information to the universal asynchronous receiver-transrnitter; and
a gate which stops flow of the serial data to the universal asynchronous receiver-transmitter while the first and second characters of the AT command are being input.
The above device modulates a received infrared signal representing the serial data, and outputs the serial data to the UART. The device also detects the baud rate, the parity type, and the data format based on the infrared signal and the AT command, and sets thus detected information to the UART. Therefore, the UART can receive the serial data represented by the infrared signal in accordance with the information without CPU processing.
In this case, the baud rate detector may measure a time period between a first pulse and a second pulse of the infrared signal, and divides the measured time period in half to obtain the baud rate;
the character discriminator detects the first and second characters represented by the received serial data to discriminate whether the input characters represent the AT command, and
the property detector checks parity bits for the first and second characters of the AT command, and detects a second data communication property including the parity type and the data format based on level of the parity bits.
Moreover, the character discriminator may supply an instruction signal to the clock generator to generate a clock signal for data reception when the character discriminator discriminates that the received serial data represent the AT command, and the character discriminator quits supplying the instruction signal and discriminates whether a further AT command is received when the character discriminator detects a last character of the AT command; and
the clock generator generates the clock signal for the data reception in response to the instruction signal supplied by the character discriminator, and quits generating the clock signal when the supply of the instruction signal is stopped.
The device may further comprise a timeout detector which monitors whether the demodulator outputs the serial data while measuring a time period during an interval of the data output, and controls the baud rate detector to quit the baud rate detection when the measured time period exceeds a predetermined time period.
In thus structured device, the clock generator does not generate the clock signal until the AT command is received. As a result, power consumption at the clock generator while standing by for the AT command arrive is reduced. Moreover, the baud rate detection by the baud rate detector rests when no serial data is supplied for the predetermined time period. As a result, more effective power saving is realized.